package com.wantup.demo03xd.part06.atomic;

import java.util.concurrent.atomic.AtomicIntegerArray;

/**
 * @author Zhaoluowei
 * @version 1.0
 * @date 2019/7/4 10:29
 */
public class AtomicIntegerArrayDemo {

    public static void main(String[] args) {

        int[] arr = new int[]{1, 2, 34};
        AtomicIntegerArray atomicIntegerArray = new AtomicIntegerArray(arr);
        System.out.println(atomicIntegerArray.addAndGet(1, 10));


        System.out.println(atomicIntegerArray.compareAndSet(2, 34, 100));
        System.out.println(atomicIntegerArray.compareAndSet(2, 100, 50));
        System.out.println(atomicIntegerArray.get(2));

    }

}
